export default (config) => {
  const { detailPath } = config;
  return {
    data() {
      return {};
    },
    inject: ["reload"],
    beforeRouteLeave(to, from, next) {
      if (to.path == detailPath || detailPath.includes(to.path)) {
        if (!from.meta.keepAlive) from.meta.keepAlive = true;
      } else {
        //清除缓存
        this.reload();
      }
      next();
    },
  };
};
